package com.yunhe.abnormal.domain.data;

import com.yunhe.common.constant.LanguageConsts;
import com.yunhe.common.i18n.I18nMessageUtil;
import com.yunhe.common.i18n.LanguageHolder;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import javax.persistence.*;
import java.io.Serializable;

/**
 * 事件对象
 * @desc 事件对象定义
 * @author duanxiaoyong
 */
@ApiModel(value = "AlarmEvent", description = "事件对象")
@Entity
@Table(name = "data_alarm_event")
public class AlarmEvent implements Serializable {

    @ApiModelProperty(value = "事件ID")
    @Id
    @GeneratedValue
    private Long id;
    @ApiModelProperty(value = "单位")
    @Column(name = "firm_id")
    private Long firmId;
    @ApiModelProperty(value = "电站")
    @Column(name = "station_id")
    private Long stationId;
    @ApiModelProperty(value = "电站")
    @Column(name = "station_title")
    private String stationTitle;
    @ApiModelProperty(value = "设备")
    @Column(name = "dev_id")
    private Long devId;
    @ApiModelProperty(value = "设备名称")
    @Column(name = "dev_title")
    private String devTitle;
    @ApiModelProperty(value = "告警状态Id")
    @Column(name = "alarm_status_id")
    private Long alarmId;
    @ApiModelProperty(value = "告警状态名称")
    @Column(name = "alarm_status_title")
    private String alarmTitle;
    @ApiModelProperty(value = "告警类型Id")
    @Column(name = "alarm_type_id")
    private Long alarmTypeId;
    @ApiModelProperty(value = "告警类型代码")
    @Column(name = "alarm_type_name")
    private String alarmTypeName;
    @ApiModelProperty(value = "告警类型名称")
    @Column(name = "alarm_type_title")
    private String alarmTypeTitle;
    @ApiModelProperty(value = "异常状态代码")
    @Column(name = "abnormal_status_id")
    private Long abnormalStatusId;
    @ApiModelProperty(value = "异常状态代码")
    @Column(name = "abnormal_status_name")
    private String abnormalStatusName;
    @ApiModelProperty(value = "异常状态名称")
    @Column(name = "abnormal_status_title")
    private String abnormalStatusTitle;
    @ApiModelProperty(value = "处理人Id")
    @Column(name = "user_id_process")
    private Long userIdProcess;
    @ApiModelProperty(value = "处理人姓名")
    @Column(name = "user_title_process")
    private String userTitleProcess;
    @ApiModelProperty(value = "发生时间", example = "2018-07-10 00:00:00")
    @Column(name = "start_time")
//    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private String startTime;
    @ApiModelProperty(value = "时间戳")
    @Column(name = "start_rtime")
    private Long startRtime;
    @ApiModelProperty(value = "持续时间")
    @Column(name = "continue_time")
    private Long continueTime;
    @ApiModelProperty(value = "处理时间", example = "2018-07-10 00:00:00")
    @Column(name = "process_time")
    private String latestProcessTime;
    @Column(name = "process_rtime")
    private Long latestProcessRtime;
    @Transient
    private Long ignoreTime;
    @ApiModelProperty(value = "事件记录")
    @Column(name = "records")
    private String records;
    @ApiModelProperty(value = "告警等级名称")
    @Column(name = "alarm_level_name")
    private String alarmLevelName;
    @ApiModelProperty(value = "告警等级名称Id")
    @Column(name = "alarm_level_id")
    private Long alarmLevelId;
    @ApiModelProperty(value = "告警等级标题")
    @Column(name = "alarm_level_title")
    private String alarmLevelTitle;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getFirmId() {
        return firmId;
    }

    public void setFirmId(Long firmId) {
        this.firmId = firmId;
    }

    public Long getStationId() {
        return stationId;
    }

    public void setStationId(Long stationId) {
        this.stationId = stationId;
    }

    public String getStationTitle() {
        return stationTitle;
    }

    public void setStationTitle(String stationTitle) {
        this.stationTitle = stationTitle;
    }

    public Long getDevId() {
        return devId;
    }

    public void setDevId(Long devId) {
        this.devId = devId;
    }

    public String getDevTitle() {
        return devTitle;
    }

    public void setDevTitle(String devTitle) {
        this.devTitle = devTitle;
    }

    public Long getAlarmId() {
        return alarmId;
    }

    public void setAlarmId(Long alarmId) {
        this.alarmId = alarmId;
    }

    public String getAlarmTitle() {
        if (LanguageConsts.TYPE.EN.value().equals(LanguageHolder.getLanguage())) {
            return I18nMessageUtil.getMessage(LanguageHolder.getLanguage(), alarmTitle);
        } else {
            return alarmTitle;
        }
    }

    public void setAlarmTitle(String alarmTitle) {
        this.alarmTitle = alarmTitle;
    }

    public Long getAlarmTypeId() {
        return alarmTypeId;
    }

    public void setAlarmTypeId(Long alarmTypeId) {
        this.alarmTypeId = alarmTypeId;
    }

    public String getAlarmTypeName() {
        return alarmTypeName;
    }

    public void setAlarmTypeName(String alarmTypeName) {
        this.alarmTypeName = alarmTypeName;
    }

    public String getAlarmTypeTitle() {
        return alarmTypeTitle;
    }

    public void setAlarmTypeTitle(String alarmTypeTitle) {
        this.alarmTypeTitle = alarmTypeTitle;
    }

    public Long getAbnormalStatusId() {
        return abnormalStatusId;
    }

    public void setAbnormalStatusId(Long abnormalStatusId) {
        this.abnormalStatusId = abnormalStatusId;
    }

    public String getAbnormalStatusName() {
        return abnormalStatusName;
    }

    public void setAbnormalStatusName(String abnormalStatusName) {
        this.abnormalStatusName = abnormalStatusName;
    }

    public String getAbnormalStatusTitle() {
        if (LanguageConsts.TYPE.EN.value().equals(LanguageHolder.getLanguage())) {
            return I18nMessageUtil.getMessage(LanguageHolder.getLanguage(), abnormalStatusTitle);
        } else {
            return abnormalStatusTitle;
        }
    }

    public void setAbnormalStatusTitle(String abnormalStatusTitle) {
        this.abnormalStatusTitle = abnormalStatusTitle;
    }

    public Long getUserIdProcess() {
        return userIdProcess;
    }

    public void setUserIdProcess(Long userIdProcess) {
        this.userIdProcess = userIdProcess;
    }

    public String getUserTitleProcess() {
        return userTitleProcess;
    }

    public void setUserTitleProcess(String userTitleProcess) {
        this.userTitleProcess = userTitleProcess;
    }

    public String getStartTime() {
        return startTime;
    }

    public void setStartTime(String startTime) {
        this.startTime = startTime;
    }

    public Long getStartRtime() {
        return startRtime;
    }

    public void setStartRtime(Long startRtime) {
        this.startRtime = startRtime;
    }

    public Long getContinueTime() {
        return continueTime;
    }

    public void setContinueTime(Long continueTime) {
        this.continueTime = continueTime;
    }

    public String getLatestProcessTime() {
        return latestProcessTime;
    }

    public void setLatestProcessTime(String latestProcessTime) {
        this.latestProcessTime = latestProcessTime;
    }

    public Long getLatestProcessRtime() {
        return latestProcessRtime;
    }

    public void setLatestProcessRtime(Long latestProcessRtime) {
        this.latestProcessRtime = latestProcessRtime;
    }

    public Long getIgnoreTime() {
        return ignoreTime;
    }

    public void setIgnoreTime(Long ignoreTime) {
        this.ignoreTime = ignoreTime;
    }

    public String getRecords() {
        return records;
    }

    public void setRecords(String records) {
        this.records = records;
    }

    public String getAlarmLevelName() {
        return alarmLevelName;
    }

    public void setAlarmLevelName(String alarmLevelName) {
        this.alarmLevelName = alarmLevelName;
    }

    public Long getAlarmLevelId() {
        return alarmLevelId;
    }

    public void setAlarmLevelId(Long alarmLevelId) {
        this.alarmLevelId = alarmLevelId;
    }

    public String getAlarmLevelTitle() {
        if (LanguageConsts.TYPE.EN.value().equals(LanguageHolder.getLanguage())) {
            return I18nMessageUtil.getMessage(LanguageHolder.getLanguage(), alarmLevelTitle);
        } else {
            return alarmLevelTitle;
        }
    }

    public void setAlarmLevelTitle(String alarmLevelTitle) {
        this.alarmLevelTitle = alarmLevelTitle;
    }
}